package com.swanclouds.redfish.account.domain.Oem.BMC.role;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;
import com.swanclouds.model.account.builder.BMC.BMCUpdateUserGroup;
import com.swanclouds.model.account.builder.BMC.BMCUpdateRoleBuilder;

import java.util.List;

/**
 * @author 张立强
 * @version jdk1.8.0
 */
public class BMCUpdateUserGroupConcrete implements BMCUpdateUserGroup {

    @JsonProperty("AssignedPrivileges")
    private List<String> assignedPrivileges;

    @JsonProperty("OemPrivileges")
    private List<String> oemPrivileges;
    /**
     * Redfish 定义的权限类型
     * <p>
     * BMC: ConfigureComponents,ConfigureManager,ConfigureUsers,ConfigureSelf,Login
     * ConfigureComponents:常规配置,ConfigureManager:管理配置,ConfigureUsers:用户配置,ConfigureSelf:配置自身,Login:登录
     * <p>
     *
     * @return java.util.List&lt;String&gt;
     */
    @Override
    public List<String> getAssignedPrivileges() {
        return this.assignedPrivileges;
    }

    /**
     * 服务器自定义的权限类型
     * <p>
     * BMC: SNMP,Vmedia,KVM
     * <p>
     *
     * @return java.util.List&lt;String&gt; OemPrivileges
     */
    @Override
    public List<String> getOemPrivileges() {
        return this.oemPrivileges;
    }

    @Override
    public BMCUpdateRoleBuilder toBuilder() {
        return new BMCUpdateRoleConcreteBuilder();
    }

    public static BMCUpdateRoleBuilder builder() {
        return new BMCUpdateUserGroupConcrete().toBuilder();
    }

    public static class BMCUpdateRoleConcreteBuilder implements BMCUpdateRoleBuilder {

        private BMCUpdateUserGroupConcrete m;

        public BMCUpdateRoleConcreteBuilder() {
            this(new BMCUpdateUserGroupConcrete());
        }

        public BMCUpdateRoleConcreteBuilder(BMCUpdateUserGroupConcrete m) {
            this.m = m;
        }
        /**
         * Redfish 定义的权限类型
         * <p>
         * BMC: "ConfigureComponents","ConfigureManager","ConfigureUsers","ConfigureSelf","Login"
         * ConfigureComponents:常规配置,ConfigureManager:管理配置,ConfigureUsers:用户配置,ConfigureSelf:配置自身,Login:登录
         * <p>
         *
         * @param assignedPrivileges 权限类型
         * @return BMCUpdateRoleBuilder
         */
        @Override
        public BMCUpdateRoleBuilder AssignedPrivileges(List<String> assignedPrivileges) {
            m.assignedPrivileges = assignedPrivileges;
            return this;
        }

        @Override
        public BMCUpdateRoleBuilder AddAssignedPrivilege(String assignedPrivilege) {
            if (assignedPrivilege == null) {
                return this;
            }
            if (m.assignedPrivileges == null) {
                m.assignedPrivileges = Lists.newArrayList();
            }
            m.assignedPrivileges.add(assignedPrivilege);
            return this;
        }

        /**
         * 服务器自定义的权限类型
         * <p>
         * BMC: SNMP,Vmedia,KVM
         * <p>
         *
         * @param oemPrivileges 权限类型
         * @return BMCUpdateRoleBuilder
         */
        @Override
        public BMCUpdateRoleBuilder OemPrivileges(List<String> oemPrivileges) {
            m.oemPrivileges = oemPrivileges;
            return this;
        }

        @Override
        public BMCUpdateRoleBuilder AddOemPrivilege(String oemPrivilege) {
            if (oemPrivilege == null) {
                return this;
            }
            if (m.oemPrivileges == null) {
                m.oemPrivileges = Lists.newArrayList();
            }
            m.oemPrivileges.add(oemPrivilege);
            return this;
        }

        /**
         * Creates and return the Model Entity M
         *
         * @return M instance
         */
        @Override
        public BMCUpdateUserGroup build() {
            return m;
        }

        /**
         * Creates a Builder using the param M as the default values
         *
         * @param in The Model M
         * @return Builder
         */
        @Override
        public BMCUpdateRoleBuilder from(BMCUpdateUserGroup in) {
            m = (BMCUpdateUserGroupConcrete) in;
            return this;
        }
    }
}
